/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.historiaclinica.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
 *
 * @author pool
 */
@Entity
@Table(name = "departamento")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Departamento.findAll", query = "SELECT d FROM Departamento d"),
    @NamedQuery(name = "Departamento.findByCodDepa", query = "SELECT d FROM Departamento d WHERE d.codDepa = :codDepa"),
    @NamedQuery(name = "Departamento.findByDescDepa", query = "SELECT d FROM Departamento d WHERE d.descDepa = :descDepa")})
public class Departamento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Depa", columnDefinition="CHAR(5) unsigned")
    private String codDepa;
    @Column(name = "Desc_Depa")
    private String descDepa;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "departamento")
    private Collection<Provincia> provinciaCollection;
    /*
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codDepa")
    private Collection<AnimalMordedor> animalMordedorCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codDepa")
    private Collection<HistoriaClinica> historiaClinicaCollection;
*/
    public Departamento() {
    }

    public Departamento(String codDepa) {
        this.codDepa = codDepa;
    }

    public String getCodDepa() {
        return codDepa;
    }

    public void setCodDepa(String codDepa) {
        this.codDepa = codDepa;
    }

    public String getDescDepa() {
        return descDepa;
    }

    public void setDescDepa(String descDepa) {
        this.descDepa = descDepa;
    }

    @XmlTransient
    public Collection<Provincia> getProvinciaCollection() {
        return provinciaCollection;
    }

    public void setProvinciaCollection(Collection<Provincia> provinciaCollection) {
        this.provinciaCollection = provinciaCollection;
    }

    /*
    @XmlTransient
    public Collection<AnimalMordedor> getAnimalMordedorCollection() {
        return animalMordedorCollection;
    }

    public void setAnimalMordedorCollection(Collection<AnimalMordedor> animalMordedorCollection) {
        this.animalMordedorCollection = animalMordedorCollection;
    }

    @XmlTransient
    public Collection<HistoriaClinica> getHistoriaClinicaCollection() {
        return historiaClinicaCollection;
    }

    public void setHistoriaClinicaCollection(Collection<HistoriaClinica> historiaClinicaCollection) {
        this.historiaClinicaCollection = historiaClinicaCollection;
    }
*/
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codDepa != null ? codDepa.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Departamento)) {
            return false;
        }
        Departamento other = (Departamento) object;
        if ((this.codDepa == null && other.codDepa != null) || (this.codDepa != null && !this.codDepa.equals(other.codDepa))) {
            return false;
        }
        return true;
    }
    
}
